% These were written by CF du Toit
% NEW COMMANDS
% Shorthand references to figures, tables, running heads etc.:
\newcommand{\apdx}[1]{Appendix~\protect\ref{#1}}
\newcommand{\chap}[1]{Chapter~\protect\ref{#1}}
\newcommand{\sect}[1]{Section~\protect\ref{#1}}
\newcommand{\fig}[1]{Fig.~\protect\ref{#1}}
\newcommand{\tabl}[1]{Table~\protect\ref{#1}}
\newcommand{\eq}[1]{(\protect\ref{#1})}
\newcommand{\markrightC}[2]{\markright{CHAPTER \protect\ref{#1}. #2}}
\newcommand{\markrightA}[2]{\markright{APPENDIX \protect\ref{#1}. #2}}

% Mathematical functions:
\newcommand{\abs}[1]{\left| #1\right|}
\newcommand{\asin}{\sin^{-1}}
\newcommand{\acos}{\cos^{-1}}
\newcommand{\atan}{\tan^{-1}}
\newcommand{\acot}{\cot^{-1}}
\newcommand{\asinh}{\sinh^{-1}}
\newcommand{\acosh}{\cosh^{-1}}
\newcommand{\atanh}{\tanh^{-1}}
\newcommand{\dx}[1]{\,d#1}
\newcommand{\env}{\mbox{env}}
\newcommand{\cosec}{\mbox{cosec}}
\newcommand{\sech}{\mbox{sech}}
\newcommand{\sign}{\mbox{sign}}
\newcommand{\sinc}{\mbox{sinc}}
\newcommand{\sqr}[1]{\left( #1\right)^{2}}
\newcommand{\step}{\mbox{step}}
\newcommand{\ip}{\mbox{int}}

% Mathematical notation
\newcommand{\define}{\stackrel{\rm def}{=}}
\newcommand{\stack}[3]{\mbox{\scriptsize \begin{tabular}{@{}c@{}} $#1$\\ \mbox{\normalsize $#2$}\\ $#3$\end{tabular}}}

% Partial derivatives
\newcommand{\prdr}[2]{\frac{\partial #1}{\partial #2}}
\newcommand{\prddr}[2]{\frac{\partial^2 #1}{\partial #2^2}}

% Unit vector
\newcommand{\un}[1]{\mbox{\boldmath $\widehat{#1}$}}

% Degree symbol
\newcommand{\degree}{^{\circ}}
% Boldface characters used as special symbols
% General:
\newcommand{\bm}[1]{\mbox{\boldmath $#1$}}
% Special:
\newcommand{\E}{\mbox{\bf E}}
\newcommand{\Hm}{\mbox{\bf H}}
\newcommand{\M}{\mbox{\bf M}}
\newcommand{\N}{\mbox{\bf N}}
\newcommand{\R}{\mbox{\bf R}}
\newcommand{\C}{\mbox{\bf C}}
\newcommand{\Z}{\mbox{\bf Z}}
\newcommand{\Mi}{\vec{M}}
\newcommand{\Ni}{\vec{N}}

% The following inserts graphs in picture environment:
% (1) One graph:
%    Usage: \graph{filename}{y-axis text}{x-axis text}{height in
%            inches}{width in inches}
% (2) Two stacked graphs:
%    Usage: \graphstack{filename1}{filename2}{top graph y-axis text}
%           {bottom graph y-axis text}{x-axis text}{height1 in inches}
%           {height2 in inches}{width in inches}
% (Heights and widths refer to dimensions of binary images)
\newcommand{\graph}[5]{\centering
\begin{tabular}{@{}l@{}c@{}}
#2 & \begin{tabular}{@{}c@{}}
\protect\insertplot{#1}{#4}{#5}\\
\end{tabular}\\
& #3 
\end{tabular}}

\newcommand{\graphstack}[8]{\centering
\begin{tabular}{@{}l@{}l@{}}
#3 & \begin{tabular}{@{}c@{}}
\protect\insertplot{#1}{#6}{#8}
\end{tabular}\\
#4 & \begin{tabular}{@{}c@{}}
\protect\insertplot{#2}{#7}{#8}\\
\end{tabular}\\
& \multicolumn{1}{c}{#5}
\end{tabular}}

% NEW ENVIRONMENTS
% Latex's double rule separation and rule widths used in tables:
%  For the spacing between horizontal lines, Latex adds 1/180 inch
%  to that specified by the user, and for the spacing between
%  vertical lines, Latex adds 1/360 inch.  The default rule width
%  is about 1/180 inch, and the default double rule separation is
%  about 0.8mm.  Latex also adds the following extra space to the
%  user-specified-space above           internal block: 1/180 inch
%                -space below           internal block: 1/180 inch
%                -space on the left of  internal block: 1/360 inch
%                -space on the right of internal block:     0 inch
%  A @{} adds 1/360 inch space on the righthand side of a |, but 
%  zero space on the lefthand side of a |.
%  Latex determines the length of horizotal lines too short by 
%  1/360 inch on either end.
\newenvironment{thickbox}{\doublerulesep 0.00282cm
\begin{tabular}{@{\hspace{0.00705cm}}|@{\hspace{0.00987cm}}|@{\hspace{0.00987cm}}|@{\hspace{0.00987cm}}|@{\hspace{0.00282cm}}c@{\hspace{0.00987cm}}|@{\hspace{0.00987cm}}|@{\hspace{0.00987cm}}|@{\hspace{0.00987cm}}|@{}} 
\hline \hline \hline \hline
\doublerulesep 0.08cm}{\doublerulesep 0.00282cm\\
\hline \hline \hline \hline
\end{tabular}}

\newenvironment{thinbox}{\begin{tabular}{@{\hspace{0.00705cm}}|@{\hspace{0.00282cm}}c@{\hspace{0.00987cm}}|@{}}
 \hline}{\\
 \hline 
 \end{tabular}}

\newenvironment{doublebox}{\begin{tabular}{@{\hspace{0.00705cm}}|@{\hspace{0.0635cm}}c@{\hspace{0.07055cm}}|@{}}
 \hline 
 \arrayrulewidth 0cm\begin{tabular}{@{}c@{}}
 \hline
 \hline
 \arrayrulewidth 0.01693cm\begin{tabular}{@{\hspace{0.007055cm}}|@{\hspace{0.00282cm}}c@{\hspace{0.00987cm}}|@{}}
 \hline}{\\
 \hline
 \end{tabular}
 \arrayrulewidth 0cm\\
 \hline
 \hline
 \end{tabular}\arrayrulewidth 0.01693cm\\
 \hline 
 \end{tabular}}

